package edu.fdzc.learn.service.impl;

// 修复：添加必要的import

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.fdzc.learn.entity.ExamQuestion;
import edu.fdzc.learn.entity.vo.ExamQuestionVO;
import edu.fdzc.learn.mapper.ExamQuestionMapper;
import edu.fdzc.learn.service.ExamQuestionService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;


import java.util.List;
import java.util.stream.Collectors;

@Service
public class ExamQuestionServiceImpl extends ServiceImpl<ExamQuestionMapper, ExamQuestion> implements ExamQuestionService {

    @Override
    public List<ExamQuestionVO> getQuestionsByExam(Long examId) {
        List<ExamQuestion> questions = getQuestionsByExamId(examId);
        return questions.stream().map(q -> {
            ExamQuestionVO vo = new ExamQuestionVO();
            BeanUtils.copyProperties(q, vo);
            return vo;
        }).collect(Collectors.toList());
    }

    @Override
    public List<ExamQuestion> getQuestionsByExamId(Long examId) {
        return baseMapper.getQuestionsByExamId(examId);
    }
}
